from pyecharts import options as opts
from pyecharts.charts import WordCloud
from pyecharts.globals import SymbolType
from DataAnalyze import TypeNum

label, count = TypeNum()
words = [(l, c) for l, c in zip(label, count)]   # 使用列表生成式，生成元素为元组的列表

wordCloud = (
    WordCloud()
    .add("电影类型", words, word_size_range=[20, 100], shape=SymbolType.DIAMOND)
    .set_global_opts(title_opts=opts.TitleOpts(title="Movie Type Distribution"))
    .render("../SourceChart/WordCloud.html")
)
